<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
namespace App\Controller;

use App\Models\ArticlesModels;

class IndexController extends AbstractController
{
    public function index()
    {
        $this->api::requireParam(['user']);
        $this->api::selectableParam('test');
        if (!$this->api::verifyParam($this->request)) return $this->api::verifyError();

        return $this->api::jsonResult($this->api::getData());
    }

    public function articles()
    {
        $this->api::requireParam(['user_id']);
        if (!$this->api::verifyParam($this->request)) return $this->api::verifyError();
        $articlesModels = new ArticlesModels();
        $articleList = $articlesModels->getList($this->api::getData());

        return $this->api::jsonResult($articleList);
    }
}
